<?php

use yii\helpers\Html;
use eric\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Banners */
/* @var $form eric\widgets\ActiveForm */
?>
<div class="banners-form">

    <?php $form = ActiveForm::begin([
        'ajaxSubmitSuccess' => "function(data){\$('#banners_modal').modal('hide');\$.pjax.reload('#banners_grid_pjax');}",
        'options' => [
            'id' => 'banners_form',
            'class' => 'form-horizontal form-bordered',
        ]
    ]); ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => 128]) ?>

    <?= $form->field($model, 'media_url')->widget(\eric\widgets\FileUpload::className()) ?>

    <?= $form->field($model, 'ad_id')->dropDownList(\app\models\Advert::getAdvert()) ?>

    <?= $form->field($model, 'link_url')->textInput(['maxlength' => 256]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', '添加') : Yii::t('app', '修改'), ['class' => $model->isNewRecord ? 'btn btn-support1' : 'btn btn-support3']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
